#include<bits/stdc++.h>
using namespace std;
int n,r,s,g;
map<int,int>m;
map<int,int>::iterator it;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&r);
        m[r]++;
    }
    it=m.begin();
    s=it->second;
    it++;
    for(;it!=m.end();it++){
        r=it->second;
        if(r>s){
            g=g+s;
            s=r;
        }
        else g=g+r;
    }
    n=n-g;
    printf("%d",n);
    return 0;
}
